import fetch from './util/fetch';

/*待付款订单列表*/
export function getOrderPendingPaymentList(data) {
  return fetch({
    url: 'order/pendingPayment/list',
    method: 'post',
    data: data,
  });
}

/*待发货订单*/
export function getOrderPendingDeliverList(data) {
  return fetch({
    url: 'order/pendingDelivery/list',
    method: 'post',
    data: data,
  });
}

/*订单发货*/
export function orderDeliver(channel,id, data) {
  return fetch({
    url: 'order/sends/' + channel + '/' + id,
    method: 'put',
    data:data,
  });
}

/*已发货订单*/
export function getOrderDeliveredList(data) {
  return fetch({
    url: 'order/delivered/list',
    method: 'post',
    data: data,
  });
}

/*租赁中订单*/
export function getOrderLeaseList(data) {
  return fetch({
    url: 'order/lease/list',
    method: 'post',
    data: data,
  });
}

/*租赁逾期订单*/
export function getOrderOverdueList(data)
{
  return fetch({
    url: 'order/overdueBill/list',
    method: 'post',
    data: data,
  });
}

/*到期退还订单*/
export function getOrderExpireList(data)
{
  return fetch({
    url: 'order/expireReturn/list',
    method: 'post',
    data: data,
  });
}

/*退还中订单*/
export function getOrderReturningList(data)
{
  return fetch({
    url: 'order/returning/list',
    method: 'post',
    data: data,
  });
}

/*退还逾期订单*/
export function getOrderReturnOverdueList(data)
{
  return fetch({
    url: 'order/returnOverdue/list',
    method: 'post',
    data: data,
  });
}

/*已退还订单*/
export function getOrderReturnedList(data)
{
  return fetch({
    url: 'order/returned/list',
    method: 'post',
    data: data,
  });
}

/*待买断订单*/
export function getOrderPendingBuyoutList(data)
{
  return fetch({
    url: 'order/pendingBuyout/list',
    method: 'post',
    data: data,
  });
}

/*退还押金中订单*/
export function getOrderRefundDepositList(data)
{
  return fetch({
    url: 'order/refundDeposit/list',
    method: 'post',
    data: data,
  });
}

/*租赁完成订单*/
export function getOrderLeaseFinishedList(data)
{
  return fetch({
    url: 'order/leaseFinished/list',
    method: 'post',
    data: data,
  });
}

/*买断完成订单*/
export function getOrderBuyoutFinishedList(data)
{
  return fetch({
    url: 'order/buyoutFinished/list',
    method: 'post',
    data: data,
  });
}

/*已取消订单*/
export function getOrderCancelledList(data)
{
  return fetch({
    url: 'order/canceled/list',
    method: 'post',
    data: data,
  });
}

/*订单详情-基本信息、订单金额信息*/
export function getOrderInfoBasic(data)
{
  return fetch({
    url: 'order/detail/' + data.id,
    method: 'get',
    params: data,
  });
}

/*订单详情-商品信息*/
export function getOrderInfoGoods(data)
{
  return fetch({
    url: 'order/goods/detail/' + data.id,
    method: 'get',
    params: data,
  });
}

/*订单详情-账期列表*/
export function getOrderInfoBill(data)
{
  return fetch({
    url: 'order/bill/list/' + data.id,
    method: 'get',
    params: data,
  });
}

/*订单详情-退还信息*/
export function getOrderInfoReturn(data)
{
  return fetch({
    url: 'order/return/detail/' + data.id,
    method: 'get',
    params: data,
  });
}

/*订单详情-退押金信息*/
export function getOrderInfoRefund(data)
{
  return fetch({
    url: 'order/refundCashPledge/details/' + data.id,
    method: 'get',
    params: data,
  });
}

/*订单详情-赔偿信息*/
export function getOrderInfoCompensate(data)
{
  return fetch({
    url: 'order/compensate/detail/' + data.id,
    method: 'get',
    params: data,
  });
}

/*订单详情-买断信息*/
export function getOrderInfoBuyout(data)
{
  return fetch({
    url: 'order/buyout/detail/' + data.id,
    method: 'get',
    params: data,
  });
}

/*订单详情-租赁协议*/
export function getOrderInfoAgmt(data)
{
  return fetch({
    url: 'order/ismtAgmtToView/' + data.id,
    method: 'get',
    params: data,
  });
}

/*订单物流信息*//*data.type: user:用户端的物流，商家发货信息，merchant：用户发货物流*/
export function getOrderInfoExpress(data)
{
  if(!data.type)
  {
    data.type='user';
  }
  
  return fetch({
    url: 'order/express/' + data.type + '/details/' + data.id,
    method: 'get',
    params: data,
  });
}

/*订单确认收货*/
export function confirmOrderReceive(data)
{
  return fetch({
    url: 'order/confirmReceipt/'+ data.id,
    method: 'put',
    data: data,
  });
}

/*订单未收到货*/
export function orderUnreceived(data)
{
  return fetch({
    url: 'order/unReceived/' + data.id,
    method: 'put',
    data: data,
  });
}

/*订单赔偿项获取*/
export function getCompensateItems(data)
{
  return fetch({
    url: 'order/compensateItems/' + data.id,
    method: 'get',
    params: data,
  });
}

/*订单处理退还*/
export function orderReturnDispose(data)
{
  return fetch({
    url: 'order/disposeReturn/' + data.id,
    method: 'put',
    data: data,
  });
}

/*待赔偿列表*/
export function getOrderPendingCompensateList(data)
{
  return fetch({
    url: 'order/pendingCompensate/list',
    method: 'post',
    data: data,
  });
}

/*赔偿逾期列表*/
export function getOrderCompensateOverdueList(data)
{
  return fetch({
    url: 'order/compensateOverdue/list',
    method: 'post',
    data: data,
  });
}

/*
* 续租审核列表（tab = check 为续租申请审核列表  tab=history 为续租申请历史记录）
* */
export function getOrderRenewList(data)
{
  return fetch({
    url: 'order/relet/'+data.tab+'/list',
    method: 'post',
    data: data,
  });
}

/*
 * 续租详情
* */
export function getOrderRenewDetail(data)
{
  return fetch({
    url: 'order/relet/'+data.id,
    method: 'get',
    params: data,
  });
}

/*
* 续租审核提交
* /relet/:id/check
* */
export function renewCheck(data)
{
  return fetch({
    url: 'order/relet/'+data.id+'/check',
    method: 'put',
    data: data,
  });
}


/*导出全部订单*/
export function downloadOrders(data)
{
  return fetch({
    url: 'order/download',
    method: 'get',
    params: data,
  });
}


/*
* 买断审核列表（tab = check 为买断申请审核列表  tab=history 为买断申请历史记录）
* */
export function getOrderBuyoutList(data)
{
  return fetch({
    url: 'order/buyout/'+data.tab+'/list',
    method: 'post',
    data: data,
  });
}


/*
 * 买断详情
* */
export function getOrderBuyoutDetail(data)
{
  return fetch({
    url: 'order/buyout/'+data.id,
    method: 'get',
    params: data,
  });
}

/*
* 买断审核提交
* /relet/:id/check
* */
export function buyoutCheck(data)
{
  return fetch({
    url: 'order/buyout/'+data.id+'/check',
    method: 'put',
    data: data,
  });
}